home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / X11 / ICE / ICEconn.h < prev    next >
C/C++ Source or Header  |  2006-04-12  |  7KB  |  252 lines

  1. /* $Xorg: ICEconn.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */
  2. /******************************************************************************
  3.  
  4.  
  5. Copyright 1993, 1998  The Open Group
  6.  
  7. Permission to use, copy, modify, distribute, and sell this software and its
  8. documentation for any purpose is hereby granted without fee, provided that
  9. the above copyright notice appear in all copies and that both that
  10. copyright notice and this permission notice appear in supporting
  11. documentation.
  12.  
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15.  
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  19. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  20. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22.  
  23. Except as contained in this notice, the name of The Open Group shall not be
  24. used in advertising or otherwise to promote the sale, use or other dealings
  25. in this Software without prior written authorization from The Open Group.
  26.  
  27. Author: Ralph Mor, X Consortium
  28. ******************************************************************************/
  29.  
  30. #ifndef _ICECONN_H_
  31. #define _ICECONN_H_
  32.  
  33. #include <X11/ICE/ICElib.h>
  34.  
  35. /*
  36.  * Data structures for ICE connection object 
  37.  */
  38.  
  39. typedef struct _IceSavedReplyWait {
  40.     IceReplyWaitInfo        *reply_wait;
  41.     Bool            reply_ready;
  42.     struct _IceSavedReplyWait    *next;
  43. } _IceSavedReplyWait;
  44.  
  45. typedef struct _IcePingWait {
  46.     IcePingReplyProc        ping_reply_proc;
  47.     IcePointer            client_data;
  48.     struct _IcePingWait     *next;
  49. } _IcePingWait;
  50.  
  51. typedef struct {
  52.     char        *vendor;
  53.     char        *release;
  54.     int            version_count;
  55.     IcePoVersionRec    *version_recs;
  56.     int            auth_count;
  57.     char        **auth_names;
  58.     IcePoAuthProc    *auth_procs;
  59.     IceIOErrorProc    io_error_proc;
  60. } _IcePoProtocol;
  61.  
  62. typedef struct {
  63.     char            *vendor;
  64.     char            *release;
  65.     int                version_count;
  66.     IcePaVersionRec        *version_recs;
  67.     IceProtocolSetupProc    protocol_setup_proc;
  68.     IceProtocolActivateProc    protocol_activate_proc;
  69.     int                auth_count;
  70.     char            **auth_names;
  71.     IcePaAuthProc        *auth_procs;
  72.     IceHostBasedAuthProc    host_based_auth_proc;
  73.     IceIOErrorProc        io_error_proc;
  74. } _IcePaProtocol;
  75.  
  76. typedef struct {
  77.     char        *protocol_name;
  78.     _IcePoProtocol    *orig_client;
  79.     _IcePaProtocol       *accept_client;
  80. } _IceProtocol;
  81.  
  82. typedef struct {
  83.     Bool            in_use;
  84.     int                my_opcode;
  85.     _IceProtocol        *protocol;
  86.     IcePointer            client_data;
  87.     Bool            accept_flag;
  88.     union {
  89.     IcePaProcessMsgProc    accept_client;
  90.     IcePoProcessMsgProc    orig_client;
  91.     } process_msg_proc;
  92. } _IceProcessMsgInfo;
  93.  
  94. typedef struct {
  95.     int        his_version_index;
  96.     int        my_version_index;
  97.     char    *his_vendor;
  98.     char    *his_release;
  99.     char    my_auth_index;
  100.     IcePointer     my_auth_state;
  101.     Bool    must_authenticate;
  102. } _IceConnectToMeInfo;
  103.  
  104. typedef struct {
  105.     int        his_opcode;
  106.     int        my_opcode;
  107.     int        his_version_index;
  108.     int        my_version_index;
  109.     char    *his_vendor;
  110.     char    *his_release;
  111.     char    my_auth_index;
  112.     IcePointer     my_auth_state;
  113.     Bool    must_authenticate;
  114. } _IceProtoSetupToMeInfo;
  115.  
  116. typedef struct {
  117.     Bool     auth_active;
  118.     char    my_auth_index;
  119.     IcePointer     my_auth_state;
  120. } _IceConnectToYouInfo;
  121.  
  122. typedef struct {
  123.     int        my_opcode;
  124.     int        my_auth_count;
  125.     int        *my_auth_indices;
  126.     Bool     auth_active;
  127.     char    my_auth_index;
  128.     IcePointer    my_auth_state;
  129. } _IceProtoSetupToYouInfo;
  130.  
  131.  
  132. struct _IceConn {
  133.  
  134.     unsigned int io_ok : 1;             /* did an IO error occur? */
  135.     unsigned int swap : 1;               /* do we need to swap on reads? */
  136.     unsigned int waiting_for_byteorder : 1;  /* waiting for a ByteOrder msg? */
  137.     unsigned int skip_want_to_close : 1;     /* avoid shutdown negotiation? */
  138.     unsigned int want_to_close : 1;         /* did we send a WantToClose? */
  139.     unsigned int free_asap : 1;             /* free as soon as possible */
  140.     unsigned int unused1 : 2;             /* future use */
  141.     unsigned int unused2 : 8;             /* future use */
  142.  
  143.     IceConnectStatus connection_status; /* pending, accepted, rejected */
  144.  
  145.     unsigned char my_ice_version_index; /* which version are we using? */
  146.  
  147.     struct _XtransConnInfo *trans_conn; /* transport connection object */
  148.     unsigned long send_sequence;         /* Sequence # of last msg sent */
  149.     unsigned long receive_sequence;        /* Sequence # of last msg received */
  150.  
  151.     char *connection_string;        /* network connection string */
  152.     char *vendor;            /* other client's vendor */
  153.     char *release;            /* other client's release */
  154.  
  155.     char *inbuf;            /* Input buffer starting address */
  156.     char *inbufptr;            /* Input buffer index pointer */
  157.     char *inbufmax;            /* Input buffer maximum+1 address */
  158.  
  159.     char *outbuf;            /* Output buffer starting address */
  160.     char *outbufptr;            /* Output buffer index pointer */
  161.     char *outbufmax;            /* Output buffer maximum+1 address */
  162.  
  163.     char *scratch;            /* scratch buffer */
  164.     unsigned long scratch_size;        /* scratch size */
  165.  
  166.     int dispatch_level;            /* IceProcessMessages dispatch level */
  167.  
  168.     IcePointer context;            /* context associated with caller
  169.                        of IceOpenConnection */
  170.  
  171.     /*
  172.      * Before we read a message, the major opcode of the message must be
  173.      * mapped to our corresponding major opcode (the two clients can use
  174.      * different opcodes for the same protocol).  In order to save space,
  175.      * we keep track of the mininum and maximum major opcodes used by the
  176.      * other client.  To get the information on how to process this message,
  177.      * we do the following...
  178.      *
  179.      * processMsgInfo = iceConn->process_msg_info[
  180.      *     message->majorOpcode - iceConn->his_min_opcode]
  181.      *
  182.      * Note that the number of elements in the iceConn->process_msg_info
  183.      * array is always (iceConn->his_max_opcode - iceConn->his_min_opcode + 1).
  184.      * We check process_msg_info->in_use to see if the opcode is being used.
  185.      */
  186.  
  187.     _IceProcessMsgInfo        *process_msg_info;
  188.     char             his_min_opcode;   /* [1..255] */
  189.     char            his_max_opcode;      /* [1..255] */
  190.  
  191.  
  192.     /*
  193.      * Number of times this iceConn was returned in IceOpenConnection
  194.      * or IceAcceptConnection.
  195.      */
  196.  
  197.     unsigned char        open_ref_count;
  198.  
  199.  
  200.     /*
  201.      * Number of active protocols.
  202.      */
  203.  
  204.     unsigned char        proto_ref_count;
  205.  
  206.  
  207.     /*
  208.      * If this ICE connection was created with IceAcceptConnection,
  209.      * the listen_obj field is set to the listen object.  Otherwise,
  210.      * the listen_obj field is NULL.
  211.      */
  212.  
  213.     IceListenObj        listen_obj;
  214.  
  215.  
  216.  
  217.  
  218.     /*
  219.      * We need to keep track of all the replies we're waiting for.
  220.      * Check the comments in process.c for how this works.
  221.      */
  222.  
  223.     _IceSavedReplyWait        *saved_reply_waits;
  224.  
  225.  
  226.     /*
  227.      * We keep track of all Pings sent from the client.  When the Ping reply
  228.      * arrives, we remove it from the list.
  229.      */
  230.  
  231.     _IcePingWait        *ping_waits;
  232.  
  233.  
  234.     /*
  235.      * Some state for a client doing a Connection/Protocol Setup
  236.      */
  237.  
  238.     _IceConnectToYouInfo    *connect_to_you;
  239.     _IceProtoSetupToYouInfo    *protosetup_to_you;
  240.  
  241.  
  242.     /*
  243.      * Some state for a client receiving a Connection/Protocol Setup
  244.      */
  245.  
  246.     _IceConnectToMeInfo        *connect_to_me;
  247.     _IceProtoSetupToMeInfo    *protosetup_to_me;
  248.  
  249. };
  250.  
  251. #endif /* _ICECONN_H_ */
  252.